﻿using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using TravelServer.ValidationAttributes;

namespace TravelServer.DTOs
{
    [TouristRouteCreationDtoValidationAttribute]
    public class TouristRouteCreationDto
    {

       
        [Description("标题")]
        [Required(ErrorMessage ="不能为空！")]
        public string Title { get; set; }
        
        [Description("描述")]
        public string Description { get; set; }
        // 计算方式：原价 * 折扣
        public decimal Price { get; set; }
        //public decimal OriginalPrice { get; set; }
        //public double? DiscountPresent { get; set; }
        public DateTime CreateTime { get; set; }
        public DateTime? UpdateTime { get; set; }
        public DateTime? DepartureTime { get; set; }
        public string Features { get; set; }
        public string Fees { get; set; }
        public string Notes { get; set; }
        public double? Rating { get; set; }
        public string TravelDays { get; set; }
        public string TripType { get; set; }
        public string DepartureCity { get; set; }
        public ICollection<TouristRoutePicturesCreationDto>? TouristRoutePictures { get; set; }=new List<TouristRoutePicturesCreationDto>();

        ////自定义数据验证
        //public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
        //{
        //    if (this.Title == this.Description)
        //    {
        //        yield return new ValidationResult("标题不能与描述内容一样！", new[] { "TouristRouteCreationDto" });
        //    }
        //}
    }
}
